package com.service;

import com.entity.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Data : 2020/11/20 11:27
 * package: com.service
 * ClassName : DeptServiceFallbackMethod
 * 描述:
 **/

@Component//将该类扫描进spring容器中.
public class DeptServiceFallbackFactory implements FallbackFactory<DeptService> {
	@Override
	public DeptService create(Throwable throwable) {
		return new DeptService() {
			@Override
			public boolean addDept(Dept dept) {
				
				return false;
			}
			
			@Override
			public Dept queryById(Long id) {
				return new Dept().setDeptno(id).setDname("feign 降级操作").setDb_source("queryById()");
			}
			
			@Override
			public List< Dept > queryAll() {
				return null;
			}
		};
	}
}
